package com.sinoair.worker.service.impl;

import com.sinoair.worker.domain.User;
import com.sinoair.worker.repository.UserRepository;
import com.sinoair.worker.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * demo-vue
 * ${desc}
 * <pre>
 *  Version         Date            Author          Description
 * ---------------------------------------------------------------------------------------
 *  1.0.0           2017/08/05     senlin        -
 * </pre>
 *
 * @author senlin
 * @version 1.0.0 2017/8/5 0005 9:54
 * @date 2017/8/5 0005 9:54
 * @since 1.0.0
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserRepository userRepository;

    @Override
    public Map<String, Object> getTableData(int pageNum, int pageSize, String username) {
        try {

            List<User> userList = userRepository.findByName(username);
            int count = 12;//userRepository.getCount();
            Map<String, Object> tableData = new HashMap<>();
            tableData.put("list", userList);
            tableData.put("count", count);
            return tableData;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
